package com.booking.dao.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.booking.dao.dto.ScoreDTO;
import com.booking.dao.entity.RoomCommentDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * @author Qikai.Lin
 * @date 2023/4/23
 */
public interface RoomCommentDetailMapper extends BaseMapper<RoomCommentDetail> {

    @Select(" SELECT SUM(score) sumScore, COUNT(1) count FROM room_comment_detail WHERE homestay_id = #{homestayId}")
    ScoreDTO getScoreByHomestayId(@Param("homestayId") Long homestayId);

}
